//
//  TableViewController.m
//  homeWorkFor29
//
//  Created by 苗钧豪 on 16/8/23.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import "TableViewController.h"
#import "TableViewCell.h"
#import "ViewController.h"
#import "TableViewCell.h"
@interface TableViewController ()<UINavigationControllerDelegate>
@property (nonatomic , strong)TableViewCell *Allcell;
@end

@implementation TableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.delegate = self;
    self.imgArr = [NSArray arrayWithObjects:@"0",@"1",@"2",@"3",@"4",@"5", nil];
    self.txtArr = [NSArray arrayWithObjects:@"零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零零",@"壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹壹",@"贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰贰",@"叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁叁",@"肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆肆",@"伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍伍", nil];
    self.IT = [imageAndtext new];
    _IT.imgStr = _imgArr;
    _IT.txtStr = _txtArr;
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                            animationControllerForOperation:(UINavigationControllerOperation)operation
                                                         fromViewController:(UIViewController *)fromVC
                                                           toViewController:(UIViewController *)toVC  NS_AVAILABLE_IOS(7_0) {
    if (operation == UINavigationControllerOperationPush) {
        self.push = [pushTransitionAnimation new];
        return _push;
    } else if (operation == UINavigationControllerOperationPop) {
        self.pop = [popTransitionAnimation new];
        _pop.cell = _Allcell;
        return _pop;
    } else {
        return nil;
    }
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    _push.cell = [self.tableView cellForRowAtIndexPath:indexPath];
    _push.imgstring = _imgArr[indexPath.row];
    _push.txtstring = _txtArr[indexPath.row];
    _Allcell = _push.cell;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _imgArr.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"1" forIndexPath:indexPath];
    
    cell.oneimgview.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",_imgArr[indexPath.row]]];
    
    return cell;
}

//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//    ViewController *vc = [ViewController new];
//    vc.twoimgview.image = _imgArr[indexPath.row];
//    [self.navigationController pushViewController:vc animated:YES];
//}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/


#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"123"]) {
        ViewController *vc = segue.destinationViewController;
//        TableViewCell *cell = (TableViewCell *)sender;
//        NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
//        vc.twoimgview.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",_imgArr[indexPath.row]]];
//        vc.twoimgview.image = cell.oneimgview.image;
        
        vc.IT = self.IT;
        
//        vc.twoimgArr = _imgArr;
//        vc.twotxtArr = _txtArr;
        //        [self.navigationController pushViewController:vc animated:YES];
    }
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}


@end
